package Solution;

public class Solution {
	public int[] missingTwo(int[] nums) {
		int[] ans = new int[2];
		int n = nums.length + 2,xor = 0,res = 0;
		for(int num : nums) {
			xor ^= num;
		}
		for(int i = 0;i <= n;i++) {
			xor ^= i;
		}
		int check = xor & (-xor);
		for(int num : nums) {
			if((check & num) != 0) {
				res ^= num;
			}
		}
		ans[0] = res;ans[1] = res ^ xor;
		return ans;
	}
}
